package RJZ.Rainbow.Controller;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import javax.swing.*;
import java.awt.*;

//
@Controller
public class UIConruoller implements InitializingBean {
    @Autowired
    Welcompanel welcompanel;
    @Autowired
    SubPanel subPanel;
    @Autowired
    TakePanel takePanel;
    Container contentPane;

    public Tips getTips() {
        return tips;
    }

    Tips tips;
    JFrame window;
    JPanel low;

    public JPanel getLow() {
        return low;
    }


    public UIConruoller() throws HeadlessException {

    }

    public void work(){
        low = new JPanel();
        window=new JFrame();
        tips=new Tips();
        contentPane =  window.getContentPane();
        //window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
        window.setSize(d.width, d.height);
        window.setTitle("彩虹外卖自提柜");
        /*window.getGraphicsConfiguration().getDevice()
                .setFullScreenWindow(window);*/
        contentPane.setLayout(new GridLayout(15, 1));
        contentPane.add(welcompanel);
        low.setSize(d.width,d.height/2);
        low.setLayout(new CardLayout());
        low.add("take", takePanel);
        low.add("sub", subPanel);
        contentPane.add(low);
        window.pack();
        window.setVisible(true);
    }

    @Override
    public void afterPropertiesSet() throws Exception {


    }
}
